package com.mnb.base.controller;

import com.mnb.base.entity.StRsvrfcchB;
import com.mnb.base.entity.StRsvrfcchB;
import com.mnb.base.service.StRsvrfcchBService;
import com.mnb.base.service.impl.StRsvrfcchBServiceImpl;
import com.mnb.common.utils.R;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * (ST_RSVRFCCH_B)表控制层
 *
 * @author xxxxx
 */
@RestController
@RequestMapping("/st_rsvrfcch_b")
public class StRsvrfcchBController {
    /**
     * 服务对象
     */
    @Resource
    private StRsvrfcchBService stRsvrfcchBService;


    @RequestMapping("/list")
    public R list(StRsvrfcchB stRsvrfcchB) {
        return stRsvrfcchBService.getList(stRsvrfcchB);
    }

    @RequestMapping("/insert")
    public R insert(@RequestBody StRsvrfcchB stRsvrfcchB) {
        stRsvrfcchB.setModitime(new Date());
        return stRsvrfcchBService.insert(stRsvrfcchB);
    }

    @RequestMapping("/udpate")
    public R udpate(@RequestBody StRsvrfcchB stRsvrfcchB) {
        return stRsvrfcchBService.udpate(stRsvrfcchB);
    }

    @RequestMapping("/delete")
    @Transactional
    public R delete(@RequestBody List<StRsvrfcchB> list) {
        for (StRsvrfcchB stRsvrfcchB : list) {
            stRsvrfcchBService.deleteByPrimaryKey(stRsvrfcchB.getStcd());
        }
        return R.ok();
    }

}
